package starfire.ftp;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author zzzhc.starfire@gmail.com
 * @version 1.0
 */

public class FtpSite {
  public static int DEFAULTPORT = 21;
  public static String DEFAULTUSER = "anonymous";
  public static String DEFAULTPASSWORD = "Jftp@ftp.com";
  public static String DEFAULTLABEL = "new site";
  public static String DEFAULTTYPE = "unknown";
  public static String DEFAULTDESCRIPT = "";

  private String host = "127.0.0.1";
  private int port = DEFAULTPORT;
  private String user = DEFAULTUSER;
  private String password = DEFAULTPASSWORD;
  private String label = DEFAULTLABEL;
  private String type = DEFAULTTYPE;
  private String descript = DEFAULTDESCRIPT;

  public FtpSite(String host) {
    this.host = host;
  }

  public FtpSite() {
  }

  public String getHost() {
    return host;
  }

  public void setHost(String host) {
    this.host = host;
  }

  public int getPort() {
    return port;
  }

  public void setPort(int port) {
    this.port = port;
  }

  public String getUser() {
    return user;
  }

  public void setUser(String user) {
    this.user = user;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getLabel() {
    return label;
  }

  public void setLabel(String label) {
    this.label = label;
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public String getDescript() {
    return descript;
  }

  public void setDescript(String descript) {
    this.descript = descript;
  }

  public boolean equals(Object obj) {
    if (obj == null || ! (obj instanceof FtpSite)) {
      return false;
    }
    FtpSite site = (FtpSite) obj;
    if (site.host.equals(host) && site.port == port
        && site.user.equals(user) && site.password.equals(password)) {
      return true;
    }
    else {
      return false;
    }
  }

  public String toString()
  {
    return host+":"+port+"("+user+"@"+password+")";
  }
}